#include <iostream>
#include <set>

int const maxn = 200;
int sg[maxn][maxn];
int n = 15, k = 1;

int main()
{
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++) {
			std::set<int> s;
			if (i > 1) s.insert(sg[i - 1][j]);
			if (j > 1) s.insert(sg[i][j - 1]);
			if (j > k && i > k) s.insert(sg[i - k][j - k]);
			for (int t = 0; t < 10; t++)
				if (s.find(t) == s.end()) {
					sg[i][j] = t;
					break;
				}
		}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
	//		if (sg[i][j]) std::cout << "* "; else std::cout << ". ";
			std::cout << sg[i][j] << "  ";
		}
		std::cout << "\n";
	}
}

